#!/usr/bin/env python
# coding: utf-8

# In[1]:


import os


# In[2]:


def cnt_byte(path):
    objects=os.listdir(path)
    sum_ = 0
    for i in objects:
        i_path = os.path.join(path,i)
        if os.path.isdir(i_path):
            sum_ += cnt_byte(i_path)
        else:
            sum_ += os.path.getsize(i_path)
    return(sum_)

cnt_byte(r'C:\Users\Administrator\Desktop\test')

